/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package raccoon.suvisa.logica.servicios.localizadorServicios.beans;

import java.util.Properties;
import java.util.logging.Logger;
import raccoon.suvisa.logica.servicios.localizadorServicios.*;
import javax.ejb.Stateful;
import javax.naming.InitialContext;

import raccoon.suvisa.datos.fachadas.FachadaDatosRemote;

/**
 *
 * @author Gabriel
 */
@Stateful
public class LocalizadorDatosBean implements LocalizadorDatosLocal {

    public FachadaDatosRemote getFachadaDatos() {
        FachadaDatosRemote ret = null;
        try {
            Properties props = new Properties();
            props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
            props.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
            props.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
            props.setProperty("org.omg.CORBA.ORBInitialHost", "10.157.100.106"); //10.5.2.167
            props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
            InitialContext ic = new InitialContext(props);
            ret = (FachadaDatosRemote) ic.lookup(FachadaDatosRemote.class.getName());
        } catch (Exception ex) {
            Logger.getLogger(LocalizadorDatosBean.class.getName()).info(ex.toString());
        }
        return ret;
    }

    public boolean testLocalizadorDatosLocal() {
        FachadaDatosRemote fac = getFachadaDatos();
        boolean ret = false;
        if (fac != null) {
            ret = fac.testfachadaDatosRemote();
        }
        return ret;
    }


}
